package com.ruoyi.result.home.controller;


import com.ruoyi.result.home.domain.dto.AchievementTrendDTO;
import com.ruoyi.result.home.service.AchievementTrendService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/achievement/trend")
@Api(tags = "首页折线图")
public class AchievementTrendController {

    @Autowired
    private AchievementTrendService achievementTrendService;

    /**
     * 获取所有成果的年度趋势数据
     */
    @GetMapping("/all")
    public ResponseEntity<AchievementTrendDTO> getAllAchievementTrend() {
        return ResponseEntity.ok(achievementTrendService.getAllAchievementTrend());
    }

    /**
     * 获取指定用户的成果年度趋势数据
     */
    @GetMapping("/user/{userId}")
    public ResponseEntity<AchievementTrendDTO> getUserAchievementTrend(@PathVariable Long userId) {
        return ResponseEntity.ok(achievementTrendService.getUserAchievementTrend(userId));
    }
}

